package com.xuan.shop.exception.handler;


import com.xuan.shop.dto.HttpResp;
import com.xuan.shop.exception.*;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class AuthorityExceptionHandler {

    @ExceptionHandler
    public HttpResp handlerUserNotNull(UsernameNotNullException e){
        return new HttpResp(4001,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp handleIncorrectUsername(IncorrectUsernameException e){
        return new HttpResp(4002,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp handlerIncorrectUsernameAndPassword(IncorrectUsernameAndPasswordException e){
        return new HttpResp(4003,e.getMessage(),null,null);
    }
    @ExceptionHandler
    public HttpResp invildUser(InvildUserException e){
        return new HttpResp(4004,e.getMessage(),null,null);
    }

    @ExceptionHandler
    public HttpResp usernameIsExist(UsernameIsExistException e){
        return new HttpResp(4004,e.getMessage(),null,null);
    }

}
